package com.xuhuan.demo.arrays;

import com.xuhuan.demo.collection.entity.User;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;

import java.util.Arrays;
import java.util.List;

/**
 * @author: 徐欢
 * @date: 2023/6/24 19:43
 * @description: 数组工具类
 */
@Slf4j
public class ArraysDemo {

    /**
     * 数组转集合
     */
    @Test
    public void testAsList() {
        String[] strs={"a","b","c"};

        List<String> asList= Arrays.asList(strs);
        System.out.println(asList.size());

        User[] userArr={
                new User("name1",1),
                new User("name2",2),
                new User("name3",3)
        };
        List<User> userList = Arrays.asList(userArr);
        System.out.println(userList);
    }
}
